package xuan.controller.qimen;

import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import xuan.configuration.result.ResponseResult;
import xuan.configuration.result.ResponseResultEnum;
import xuan.dto.qimen.QiMenDto;
import xuan.utils.bazi.BaZi;
import xuan.utils.bazi.BaZiSetting;
import xuan.utils.qimen.QiMen;
import xuan.utils.qimen.QiMenSetting;
import xuan.vo.bazi.BaZiVo;
import xuan.vo.qimen.QiMenVo;

/**
 * 奇门遁甲排盘Controller
 *
 * @author 善待
 */
@RestController
@RequestMapping("/qiMen")
public class QiMenController {

    /**
     * 开始排盘
     *
     * @param dto 奇门遁甲设置接收类
     * @return 奇门遁甲数据
     */
    @PostMapping("/paiPan")
    public ResponseResult<QiMenVo> paiPan(@RequestBody QiMenDto dto) {

        // 1、拷贝设置
        QiMenSetting setting = new QiMenSetting();
        BeanUtils.copyProperties(dto, setting);

        // 2、排盘
        QiMen qiMen = new QiMen(setting);

        // 3、拷贝数据
        QiMenVo vo = new QiMenVo();
        BeanUtils.copyProperties(qiMen, vo);

        // 4、返回数据
        return ResponseResult.result(ResponseResultEnum.SUCCESS, vo);

    }


}
